from ninja import ModelSchema, Schema,Field
from typing import Optional,Any,List

class CustomUserIn(Schema):
  userId:str = Field(..., example="zs") #Field(...）表示该字段为必填字段，等价于Field(required=True)
  #Field(None) 表示字段是可选的，且默认值为 None（需要配合 Optional 类型），例如title: Optional[str] = Field(None)

class GoodIn(Schema):
  privatekey:str
  goodId:str
  quantity:int

class SuccessSchema(Schema):
  status:str
  message: str
  data: Optional[Any] = None  # 可选字段，默认为 None

class ErrorSchema(Schema):
  status:str
  message: str

class ProductListingIn(Schema):
    privatekey: str
    productId: str
    productName: str
    price: str
    imageUrl: str
    parentTradeHash: str = ""

class BuyProductsIn(Schema):
    privatekey: str
    listingHashes: List[str]  # 改为数组类型
    buyer: str
